<template>
    <div style="width:100%;height:100%;overflow:hidden auto">
        <weui-cell :list="cell_0_list">
        </weui-cell>
    </div>
</template>
<script>
import WeuiCell from '../vue2componentSet/src/components/WeuiCell'
import global from '../lib/global'
import axios from 'axios'

export default {
    components: {
        WeuiCell
    },
    data() {
        return {
            data: []
        }
    },
    mounted() {
        this.$store.commit('set_title', '拉新活动（4至6月）')

        if (!this.$store.state.admin) {
            this.$router.goback()
            return
        }

        this.getData()
    },
    methods: {
        getData() {
            axios.post(global.server + 'getActivity0TotalData.do', {}).then(result => {
                var obj = result.data
                this.data = obj
            })
        }
    },
    computed: {
        cell_0_list() {
            var result = []
            this.data.forEach(item => {
                var hasBillNum = 0
                item.promotees.forEach(_item => {
                    if (_item.hasBill)
                        ++hasBillNum
                })
                result.push({
                    value: item.promoter_phone,
                    desc: hasBillNum + '/' + item.promotees.length,
                })
            })
            return result
        }
    }
}

</script>